home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic Toolbox
/
Visual Basic Toolbox (P.I.E.)(1996).ISO
/
toolkit
/
vbof_v11
/
democomp.cls
< prev
next >
Wrap
Text File
|
1996-03-01
|
3KB
|
137 lines
VERSION 1.0 CLASS
BEGIN
MultiUse = -1 'True
END
Attribute VB_Name = "Company"
Attribute VB_Creatable = False
Attribute VB_Exposed = True
Option Explicit
' the following pertain to being supported by
' VBOFCollection, VBOFObjectManager and
' VBOFEventManager
'Public ObjectID As Long
Public ObjectChanged As Long
Public ObjectAdded As Long
Public ObjectDeleted As Long
Public ObjectParentCount As Long
Public ObjectManager As VBOFObjectManager
' the following code pertains to the business
' of the Company object
Private pvtPersonsCollection As VBOFCollection
Private Sub Class_Terminate()
If Not ObjectManager Is Nothing Then
ObjectManager.TerminateObject _
Object:=Me
End If
End Sub
Public Function ObjectHasChanged()
' Mark this object as "Changed" and trigger the
' "Changed" event
ObjectChanged = True
#If NoEventMgr = False Then
If Not ObjectManager Is Nothing Then
ObjectManager. _
TriggerObjectEvent _
Event:="Changed", _
Object:=Me
End If
#End If
End Function
Public Function ObjectEventCallBack(Optional Event As Variant, Optional Object As Variant) As Long
' Receive the Trigger notification and process
' accordingly
'
' Parameters:
' Event
' a string which identifies the Event
' Example: "Changed", "Created", "Deleted"
' Object
' the object originating the Event.
' responds to:
' TypeName(TriggerObject)
' TriggerObject.ObjectID
' (supported by VBOFEventManager)
End Function
Public Function ObjectDataSource() As String
ObjectDataSource = "Company"
End Function
Public Function EmptyPersons() As Variant
' Return an emptied Persons collection
' (handy when wanting to begin processing the Company
' after having already done some things with it)
Set pvtPersonsCollection = _
ObjectManager. _
NewVBOFCollection _
(Parent:=Me)
ObjectHasChanged
Set EmptyPersons = Persons()
End Function
Public Function Persons(Optional ObjectID As Variant) As Variant
' Returns a VBOFCollection of Person objects which are
' contained by this Company object,
' or
' Returns a Person object whose ObjectID matches the ObjectID
' parameter.
Dim tempNewPerson As New Person
Set Persons = _
ObjectManager. _
ManageCollection( _
ObjectID:=ObjectID, _
Collection:=pvtPersonsCollection, _
Parent:=Me, _
Sample:=tempNewPerson, _
Database:=CompanyDatabase, _
OrderByClause:="LastName ASC, FirstName ASC")
' other available parameters:
' ODBCPassThrough:=True,
' ANSISQL:=True,
End Function
Public Function AddPerson(Optional Item As Variant, Optional Parent As Variant) As Person
' Return a Person, added to my pvtPersonsCollection
' (just a wrapper method for Persons.Add)
Set AddPerson = Me.Persons.Add( _
Item:=Item, _
Parent:=Me, After:=Me.Persons(1))
ObjectHasChanged
End Function
Private Sub Class_Initialize()
Set ObjectManager = Nothing
End Sub
Public Property Get ObjectID() As Long
ObjectID = 1
End Property